<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="ansible,vagrant," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="前提假定下述工具已经安装，本环境基于ubuntu 14.04（deepin）。

Vagrant 1.7.4
Virtualbox 5.0.2
Ansible 1.9.2
编辑器使用Atom">
<meta property="og:type" content="article">
<meta property="og:title" content="采用Vagrant搭建Ansible playbook脚本开发测试环境">
<meta property="og:url" content="http://chrisrc.me/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/index.html">
<meta property="og:site_name" content="山中，山外与俯瞰">
<meta property="og:description" content="前提假定下述工具已经安装，本环境基于ubuntu 14.04（deepin）。

Vagrant 1.7.4
Virtualbox 5.0.2
Ansible 1.9.2
编辑器使用Atom">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_init.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_atom_project.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ssh_config.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ansible_cfg.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ansible_hosts.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ansible_test.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_destroy.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_file.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ssh_config2.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ansible_cfg.png">
<meta property="og:image" content="http://chrisrc.me/images/autoit_vagrant_ansible_test2.png">
<meta property="og:updated_time" content="2016-12-17T07:29:29.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="采用Vagrant搭建Ansible playbook脚本开发测试环境">
<meta name="twitter:description" content="前提假定下述工具已经安装，本环境基于ubuntu 14.04（deepin）。

Vagrant 1.7.4
Virtualbox 5.0.2
Ansible 1.9.2
编辑器使用Atom">
<meta name="twitter:image" content="http://chrisrc.me/images/autoit_vagrant_init.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://chrisrc.me/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/"/>





  <title> 采用Vagrant搭建Ansible playbook脚本开发测试环境 | 山中，山外与俯瞰 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">山中，山外与俯瞰</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">一次永不停止的探索之旅</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-dcos">
          <a href="/dcos" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-book"></i> <br />
            
            DC/OS
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="st-search-show-outputs">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <form class="site-search-form">
  <input type="text" id="st-search-input" class="st-search-input st-default-search-input" />
</form>

<script type="text/javascript">
  (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
    (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
    e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
  })(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');

  _st('install', 'R9GcmhBwxpsAGLNCsquZ','2.0.0');
</script>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                采用Vagrant搭建Ansible playbook脚本开发测试环境
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-09-01T07:24:27+08:00">
                2015-09-01
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT自动化/" itemprop="url" rel="index">
                    <span itemprop="name">IT自动化</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <div class="toc"></div>

<h2 id="前提"><a href="#前提" class="headerlink" title="前提"></a>前提</h2><p>假定下述工具已经安装，本环境基于ubuntu 14.04（<a href="http://www.deepin.org/" target="_blank" rel="external">deepin</a>）。</p>
<ul>
<li><a href="https://www.vagrantup.com/" target="_blank" rel="external">Vagrant</a> 1.7.4</li>
<li><a href="https://www.virtualbox.org/" target="_blank" rel="external">Virtualbox</a> 5.0.2</li>
<li><a href="http://www.ansible.com/" target="_blank" rel="external">Ansible</a> 1.9.2</li>
<li>编辑器使用<a href="https://github.com/atom/atom" target="_blank" rel="external">Atom</a></li>
</ul>
<a id="more"></a>
<h2 id="创建工程"><a href="#创建工程" class="headerlink" title="创建工程"></a>创建工程</h2><p>示例工程位于<code>~/Ansible/demo</code></p>
<blockquote>
<p>mkdir -p ～/Ansible/demo<br>cd ~/Ansible/demo</p>
</blockquote>
<p>通过下面的命令查看本地已存在的Vagrant box</p>
<blockquote>
<p>vagrant box list</p>
</blockquote>
<p>如果不存在，执行下面的命令，本示例使用<code>chef/ubuntu-14.04</code>：</p>
<blockquote>
<p>vagrant init chef/ubuntu-14.04</p>
</blockquote>
<p>系统输出如下所示：<br><img src="/images/autoit_vagrant_init.png" alt="vagrant_init"></p>
<p>通过Atom打开～/Ansible/demo工程目录，如下所示：<br><img src="/images/autoit_vagrant_atom_project.png" alt="vagrant_atom_project"></p>
<p>Vagrant测试用虚拟机已经准备好。下面检查虚拟机的信息，用于后续ansible playbook与虚拟机交互</p>
<ul>
<li>执行下面的命令启动虚拟机：</li>
</ul>
<blockquote>
<p>vagrant up</p>
</blockquote>
<ul>
<li>执行下面的命令查看虚拟机的SSH相关信息：</li>
</ul>
<blockquote>
<p>vagrant ssh-config</p>
</blockquote>
<p><img src="/images/autoit_vagrant_ssh_config.png" alt="autoit_vagrant_ssh_config"></p>
<p>通过Atom，在demo目录下添加ansible.cfg文件，在根据上述信息，在文件中进行如下配置：</p>
<blockquote>
<p>[defaults]<br>hostfile = hosts     # ansible默认到hosts文件中查找主机配置<br>remote_user = vagrant      #ansible默认以vagrant用户通过ssh访问虚拟机<br>private_key_file = .vagrant/machines/default/virtualbox/private_key   #SSH private key<br>host_key_checking = False #忽略对测试虚拟机的Key检查</p>
</blockquote>
<p><img src="/images/autoit_vagrant_ansible_cfg.png" alt=""></p>
<p>添加hosts文件:</p>
<blockquote>
<p>[demo]<br>vagrant1 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222</p>
</blockquote>
<p>因为在ansible.cfg文件中配置了默认的ssh用户vagrant，这里省略了ansible_ssh_user及ansible_ssh_pass<br><img src="/images/autoit_vagrant_ansible_hosts.png" alt=""></p>
<p>到此，测试虚拟机的环境已经初步搭建完成，下面可以在命令行进行测试：<br><img src="/images/autoit_vagrant_ansible_test.png" alt=""></p>
<p>在实际测试中，往往需要测试同时部署多台主机的playbook脚本，下面对Vagrantfile进行重新配置，同时开启多个测试机：</p>
<ol>
<li><p>首先，废弃当前的虚拟机（如果只是停止，使用：vagrant halt）：<br><img src="/images/autoit_vagrant_destroy.png" alt=""></p>
</li>
<li><p>修改Vagrantfile文件：<br><img src="/images/autoit_vagrant_file.png" alt=""><br>如上所示，配置了三个虚拟机，每个虚拟机向当前主机开放80及443端口并映射到当前主机的不同端口。</p>
</li>
<li><p>执行vagrant up，启动三个虚拟机。<strong>注意，重新启动的三个虚拟机，ssh端口会重新分配，需要重新执行<code>vagrant ssh-config</code>查看</strong>：<br><img src="/images/autoit_vagrant_ssh_config2.png" alt=""></p>
</li>
<li><p>修改hosts文件配置所有主机：</p>
</li>
</ol>
<blockquote>
<p>[demo]<br>vagrant1 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222<br>vagrant2 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2200<br>vagrant3 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2201  </p>
</blockquote>
<p>Vagrant1.7之后，会为每一个虚拟机生成一个private key，可以在host主机配置中分别添加如下配置：  </p>
<blockquote>
<p>[demo]<br>vagrant1 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_private_key_file=.vagrant/machines/vagrant1/virtualbox/private_key<br>vagrant2 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2200 ansible_ssh_private_key_file=.vagrant/machines/vagrant2/virtualbox/private_key<br>vagrant3 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2201 ansible_ssh_private_key_file=.vagrant/machines/vagrant3/virtualbox/private_key  </p>
</blockquote>
<p>为了简化配置，同时访问多个主机，修改ansible.cfg文件，使用Vagrant的默认key：<br>private_key_file = ~/.vagrant.d/insecure_private_key<br><img src="/images/autoit_vagrant_ansible_cfg.png" alt=""></p>
<p>到此，多主机测试就绪。可以通过命令行进行测试：<br><img src="/images/autoit_vagrant_ansible_test2.png" alt=""></p>
<h2 id="编写Ansible部署脚本"><a href="#编写Ansible部署脚本" class="headerlink" title="编写Ansible部署脚本"></a>编写Ansible部署脚本</h2><p>对于ansible playbook的编写请参考后续文档介绍。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/ansible/" rel="tag"># ansible</a>
          
            <a href="/tags/vagrant/" rel="tag"># vagrant</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/08/27/autoit-jenkins-jobs-in-eclipse/" rel="next" title="在Eclipse中管理Jenkins任务">
                <i class="fa fa-chevron-left"></i> 在Eclipse中管理Jenkins任务
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/09/02/autoit-sonarqube-eclipse/" rel="prev" title="代码审查工具SonarQube与Eclipse集成">
                代码审查工具SonarQube与Eclipse集成 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/"
     data-title="采用Vagrant搭建Ansible playbook脚本开发测试环境"
     data-content=""
     data-url="http://chrisrc.me/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/"
           data-title="采用Vagrant搭建Ansible playbook脚本开发测试环境" data-url="http://chrisrc.me/2015/09/01/autoit-ansible-with-vagrant-and-virtualbox/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="chrisrc" />
          <p class="site-author-name" itemprop="name">chrisrc</p>
          <p class="site-description motion-element" itemprop="description"></p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">69</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">162</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/christtrc" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/chrisrc" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#前提"><span class="nav-number">1.</span> <span class="nav-text">前提</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建工程"><span class="nav-number">2.</span> <span class="nav-text">创建工程</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#编写Ansible部署脚本"><span class="nav-number">3.</span> <span class="nav-text">编写Ansible部署脚本</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">
     
      <a href="mailto:chrisrc@qq.com">chrisrc</a> 
    
  </span>
  <span class="author"> &nbsp; QQ: 58122705 </span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"chrisrc"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  








  
  

  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
<script>
(function(){
   var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04":"https://jspassport.ssl.qhimg.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04";
   document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
</script>

  


</body>
</html>
